<?php
include('HTGPage.class.php');

$page = new HTGPage();
/* @var $utils Utils */
$utils = $page->myUtils;

/* @var */

if(@$_REQUEST['promoName']) {
	$promoNameOrig = @$_REQUEST['promoName'];
	$promoName = trim($promoNameOrig);
	$promoName = str_ireplace(' ', '', $promoName);	

	$promoURL = 'http://halftimegenius.com/getit.php?r=' . urlencode($promoName); //this secures our site

	//utils create promo record
	$utils->addPromo($promoNameOrig, $promoURL);
	$myEcho = 'The link for HalfTime Genius you\'ll need to use to sign up: ' . $promoURL . '
	Also, forward this email along.  If they signup using your link, we\'ll return the favor.';
	$subject = "The HalfTime Genius Link you requested. " . $promoNameOrig;
	$body = $myEcho;
	$page->content .= $myEcho;	
	
	$headers = 'From: "HalfTime Genius" <HalfTimeGenius@gmail.com>' . "\r\n" .
	    'Reply-To: halftimegenius@gmail.com' . "\r\n" .
	    'X-Mailer: PHP/' . phpversion();
	mail($promoNameOrig, $subject, $body, $headers);
	mail('arashghaneian@gmail.com', $subject, $body, $headers);
}

$page->preHeadCloseContent .= '
<link href="linkCreator.css" type="text/css" rel="stylesheet" />';
$page->content .= $utils->get_include_contents("linkCreator.html");

$page->display();

?>